package com.micro.school.system.service.impl;

import java.util.List;

import com.micro.school.common.core.context.SecurityContextHolder;
import com.micro.school.common.core.utils.DateUtils;
import com.micro.school.common.security.utils.SecurityUtils;
import com.micro.school.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.micro.school.system.mapper.DiscountActivityMapper;
import com.micro.school.system.domain.DiscountActivity;
import com.micro.school.system.domain.vo.DiscountActivityVo;
import com.micro.school.system.convert.discount.DiscountActivityConvert;
import com.ruoyi.system.service.IDiscountActivityService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 【请填写功能名称】Service业务层处理
 * 
 * @author rakic
 * @date 2025-08-05
 */
@Service
public class DiscountActivityServiceImpl extends ServiceImpl<DiscountActivityMapper,DiscountActivity> implements IDiscountActivityService
{
    @Autowired
    private DiscountActivityMapper discountActivityMapper;

    /**
     * 查询【请填写功能名称】
     * 
     * @param id 【请填写功能名称】主键
     * @return 【请填写功能名称】
     */
    @Override
    public DiscountActivityVo selectDiscountActivityById(Long id)
    {

        return discountActivityMapper.selectDiscountActivityById(id, Integer.parseInt(SecurityContextHolder.getUserTenantId()));
    }

    /**
     * 查询【请填写功能名称】列表
     * 
     * @param discountActivityVo 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<DiscountActivityVo> selectDiscountActivityList(DiscountActivityVo discountActivityVo)
    {
        return discountActivityMapper.selectDiscountActivityList(discountActivityVo);
    }

    /**
     * 新增【请填写功能名称】
     * 
     * @param discountActivityVo 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertDiscountActivity(DiscountActivityVo discountActivityVo)
    {
        DiscountActivity discountActivity = DiscountActivityConvert.INSTANCE.convert(discountActivityVo);

        discountActivity.setCreateTime(DateUtils.getNowDate());

        return discountActivityMapper.insert(discountActivity);

    }

    /**
     * 修改【请填写功能名称】
     * 
     * @param discountActivityVo 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateDiscountActivity(DiscountActivityVo discountActivityVo)
    {
        DiscountActivity discountActivity = DiscountActivityConvert.INSTANCE.convert(discountActivityVo);
        return discountActivityMapper.updateDiscountActivity(discountActivity);
    }

    /**
     * 批量删除【请填写功能名称】
     * 
     * @param ids 需要删除的【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteDiscountActivityByIds(List<Long> ids)
    {

        return discountActivityMapper.deleteDiscountActivityByIds(ids, Integer.parseInt(SecurityContextHolder.getUserTenantId()));
    }

    /**
     * 删除【请填写功能名称】信息
     * 
     * @param id 【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteDiscountActivityById(Long id)
    {

        return discountActivityMapper.deleteDiscountActivityById(id, Integer.parseInt(SecurityContextHolder.getUserTenantId()));
    }

}
